package com.easyadmin.modules.stock.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.easyadmin.common.web.domain.request.PageDomain;
import org.springframework.stereotype.Service;
import com.easyadmin.modules.stock.mapper.SysStockOptionsDao;
import com.easyadmin.modules.stock.domain.SysStockOptions;
import com.easyadmin.modules.stock.service.ISysStockOptionsService;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * 期权产品Service业务层处理
 *
 * @author jmys
 * @date 2025-10-02
 */
@Service
public class SysStockOptionsServiceImpl extends ServiceImpl<SysStockOptionsDao,SysStockOptions> implements ISysStockOptionsService {

    @Resource
    private SysStockOptionsDao sysStockOptionsDao;

    /**
     * 查询期权产品
     * @param sysStockOptions 期权产品
     * @param pageDomain
     * @return 期权产品 分页集合
     * */
    @Override
    public PageInfo<SysStockOptions> selectSysStockOptionsPage(SysStockOptions sysStockOptions, PageDomain pageDomain) {
        PageHelper.startPage(pageDomain.getPage(), pageDomain.getLimit());
        List<SysStockOptions> data = sysStockOptionsDao.selectSysStockOptionsList(sysStockOptions);
        return new PageInfo<>(data);
    }

    @Override
    public Boolean remove(String id) {
        return sysStockOptionsDao.deleteById(id) > 0;
    }

    @Override
    public boolean update(SysStockOptions sysStockOptions) {
        return sysStockOptionsDao.updateById(sysStockOptions) > 0;
    }

    @Override
    @Transactional
    public boolean batchRemove(String[] ids) {
        for (String id : ids) {
            sysStockOptionsDao.deleteById(Integer.parseInt(id));
        }
        return true;
    }

}
